package com.freecat.xmqgct.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.freecat.xmqgct.R;


/**
 * @author haha
 * @ClassName: MyCustomDialog
 */
public class ExamineDialog extends Dialog {

    private Context context;
    private String title;
    private Iback iback;
    private TextView mTile;
    private EditText editText;
    private Button btn_confirm;
    private Button btn_cancel;


    public ExamineDialog(Context context, String title, Iback iback) {
        super(context, R.style.CustomDialog);
        this.title = title;
        this.iback = iback;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);// NoTitle
        setContentView(R.layout.dialog_examine_layout);
        mTile = findViewById(R.id.tv_title);
        editText = findViewById(R.id.et_message);
        btn_confirm = findViewById(R.id.btn_confirm);
        btn_cancel = findViewById(R.id.btn_cancel);
        mTile.setText(title);

        btn_confirm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                iback.back(editText.getText().toString().trim());
                dismiss();
            }
        });
        btn_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

    }


    public interface Iback {
        void back(String text);
    }

}
